function animate(ele, obj, fn=function(){}){
    let num = 0
    for(let attr in obj){
        num++
        let target = obj[attr]
        if(attr === 'opacity'){
            target *= 100
        }
        let currentStyle = getStyle(ele, attr)
        if(attr === 'opacity'){
            currentStyle *= 100
        }
        currentStyle = parseInt(currentStyle)
        let timerId = setInterval(function(){
            let speed = (target - currentStyle)/10
            speed = speed>0?Math.ceil(speed):Math.floor(speed)
            currentStyle += speed
            if(attr === 'opacity'){
                ele.style[attr] = currentStyle/100
            }else{
                ele.style[attr] = currentStyle + 'px'
            }
            if(currentStyle === target){
                clearInterval(timerId)
                num--
                if(num === 0){
                    fn()
                }
            }
        },20)
    }
}

